package com.zzh.sl.empty;

import com.zzh.sl.ICountAdapter;

import androidx.recyclerview.widget.RecyclerView;

public class RecyclerAdapterEmptyStrategy extends SourceCountEmptyStrategy<RecyclerView.Adapter> {
    public RecyclerAdapterEmptyStrategy(RecyclerView.Adapter source) {
        super(source);
    }

    public RecyclerAdapterEmptyStrategy(RecyclerView.Adapter source, int emptyCount) {
        super(source, emptyCount);
    }

    @Override
    protected int getCount() {
        RecyclerView.Adapter source = getSource();
        if (source instanceof ICountAdapter) {
            return ((ICountAdapter) source).getItemRealCount();
        }
        return source.getItemCount();
    }
}
